package com.xq.demo;

import com.alibaba.fastjson.JSON;
import com.google.common.collect.Lists;
import com.xq.vo.BindCardExtVo;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileInputStream;
import java.security.InvalidParameterException;
import java.util.*;

public class Demo {

    public static String output="";



    public int get(){
        try{
            return 1;
        }catch (Exception ex){
            ex.printStackTrace();
        }finally {
            return 2;
        }
    }
    public static void main(String[] args) throws Exception{
      new HelloB();
    }

    public static class HelloA{
        public HelloA(){
            System.out.println("HelloA");
        }
        {
            System.out.println("Im A class");
        }
        static {
            System.out.println("static A");
        }
    }

    public static class HelloB extends HelloA{
        public HelloB(){
            System.out.println("HelloB");
        }
        {
            System.out.println("Im B class");
        }
        static {
            System.out.println("static B");
        }
    }

    public static int foo(int n){
        if(n<2){
            return n;
        }else {
            return foo(n-1)+foo(n-2);
        }
    }



   /* public static Boolean cmp(String a,String b) throws Exception{
        private Boolean ret = false;
        if(a==null || b==null){
            throw new InvalidParameterException();
        }
        ret =(a==b);
        return ret;
    }*/

    static class Test{
        private String myValue="000000";
        public Test(String s){
            this.myValue=s;
        }

        public void printValue(){
            System.out.println(myValue);
        }

        static public void changeValue(String s){
            s="222222";
        }
    }

    static void pong(){
        System.out.println("pong");
    }

    static class A{
        public A(){
            System.out.println("A");
        }
    }

    static class B extends A{
        public B(){
            System.out.println("B");
        }
    }

    public static void test(String s) {
        boolean modify = false;
        int len = 0;
        char[] re = new char[s.length()];
        for (int i = 0; i < s.length(); i++) {
            if (s.charAt(i) != '*') {
                re[len++] = s.charAt(i);
            }
        }
        char[] res = new char[len];
        System.arraycopy(re, 0, res, 0, len);
        char slow = 0;
        char fast = 1;
        while (fast < len) {
            if (fast + 1 < len && res[fast] == res[fast + 1] && res[fast] == res[slow]) {
                char temp = res[slow];
                while (fast < len && res[fast] == temp) {
                    modify = true;
                    res[slow] = '*';
                    res[fast] = '*';
                    fast++;
                }
            }
            slow = fast;
            fast++;
        }
        if (modify) {
            test(new String(res));
        } else
            System.out.println(Arrays.toString(res));
    }

    public static void modify(String s){
        s+="word!";
    }


    static class X{
        X(){
            System.out.print("X");
        }

    }

    static class Y{
        Y(){
            System.out.print("Y");
        }

    }

    static class Z extends X{
        Y y = new Y();
        Z(){
            System.out.print("Z");
        }
    }



    public void first(){
        int i=5;
        Value v = new Value();
        v.i=25;
        second(v,i);
        System.out.print(v.i);
    }

    public void second(Value v,int i){
         i=0;
        v.i=20;
        Value val1 = new Value();
        v=val1;
        System.out.print(v.i+""+i);
    }

    static class Value{
    public  int i=15;
    }


}


